<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core"> 
    <ui:composition template="index.xhtml">
        <ui:define name="body">


            <h:form>
                <div id="breadcrumb">
                    <p:commandLink  value="Inicio" update="@form" actionListener="#{managerRedirect.redirect('index.xhtml')}" immediate="true"/> >
                    <p:commandLink  value="Configurações" update="@form" actionListener="#{managerRedirect.redirect('configuration.xhtml')}" immediate="true"/> >
                    <p:commandLink  value="Category" immediate="true"/> > 
                </div>
            </h:form>
            <p:panel header="Categoria">

                <h:form id="form" acceptcharset="utf-8">
                    <p:growl id="msg" life="5000"/>
                    <table style="min-height:500px; width: 100%">
                        <tr>
                            <td style="width: 20%; vertical-align:top;">
                                <p:menu style="width:200px;" >  
                                    <p:submenu label="Categoria">  
                                        <p:menuitem value="Cadastrar" 
                                                    actionListener="#{managerRedirect.redirect('createCategory.xhtml')}"
                                                    update="@form" icon="ui-icon-circle-plus"/>  
                                        <p:menuitem value="Pesquisar" rendered="false"
                                                    actionListener="#{managerRedirect.redirect('searchCategory.xhtml')}"
                                                    icon="ui-icon-circle-zoomout"/>   
                                    </p:submenu>
                                </p:menu>

                            </td>
                            <td style="vertical-align:top;">

                                    <p:dataTable value="#{managerSearchCategory.lstCategorys()}"
                                                 var="c" emptyMessage="Nenhuma Categoria"
                                                 styleClass="dataTable" style="width: 100%;"
                                                 >                       
                                        <f:facet name="header">
                                            <h:outputText value="Categorias"/>
                                        </f:facet>
                                        <p:column headerText="Categoria" style="font-size: 12px;">
                                            <h:outputText value="#{c.name}" style="font-size: 12px;"/>
                                        </p:column>
                                        <p:column headerText="Opções" style="font-size: 12px; width: 15%; padding-right: 0px; ">
                                            <p:commandButton  icon="ui-icon-folder-collapsed" actionListener="#{managerEditCategory.redirectCateogry('editCategory.xhtml', c)}" title="Editar"  />
                                            <p:commandButton  icon="ui-icon-circle-zoomin" actionListener="#{managerSearchCategory.redirect('showCategory.xhtml', c)}" title="Visualizar" />
                                            <p:commandButton  icon="ui-icon-trash" title="Excluir" update="@form"  />
                                        </p:column>
                                    </p:dataTable>
                            </td></tr></table>

                </h:form>
            </p:panel>
        </ui:define>
    </ui:composition>
</html>